package com.ehotting.edsta.diagnosisPredict.controller;

import com.ehotting.eaf.core.domain.R;
import com.ehotting.eaf.core.web.domain.diagnosisPredict.PageDto;
import com.ehotting.edsta.diagnosisPredict.domain.dto.AlgoTemplate;
import com.ehotting.edsta.diagnosisPredict.feign.AlgoTemplateFileFeignService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 算法模板
 */
@RestController
@RequestMapping("/algoTemplateFile")
@Api(tags = "AlgoTemplateController",description = "算法模板")
public class AlgoTemplateController {

    @Autowired
    private AlgoTemplateFileFeignService algoTemplateFileFeignService;

    /**
     * 算法列表
     *
     * @return
     */
    @GetMapping(value = "/pageList")
    @ApiOperation("算法列表")
    public R<PageDto<AlgoTemplate>> pageList(
            @RequestParam("algoname") String algoname,
            @RequestParam("bucketDir") String bucketDir,
            @RequestParam("counts") Integer counts,
            @RequestParam("createTime") String createTime,
            @RequestParam("creater") String creater,
            @RequestParam("fileaslias") String fileaslias,
            @RequestParam("filename") String filename,
            @RequestParam("id") Long id,
            @RequestParam("iteminfoId") Long iteminfoId,
            @RequestParam("language") String language,
            @RequestParam("packageaslias") String packageaslias,
            @RequestParam("packagename") String packagename,
            @RequestParam("packageurl") String packageurl,
            @RequestParam("purpose") String purpose,
            @RequestParam("remarks") String remarks,
            @RequestParam("status") String status,
            @RequestParam("version") String version,
            @RequestParam("page") Long page,
            @RequestParam("pageSize") Long pageSize
    ){
        return R.convert(algoTemplateFileFeignService.pageList(algoname, bucketDir, counts, createTime, creater,
                fileaslias, filename, id, iteminfoId, language, packageaslias, packagename,
                packageurl, purpose, remarks, status, version, page, pageSize));
    }

    /**
     * 单个/批量删除
     *
     * @return
     */
    @GetMapping(value = "/deleteByIds")
    @ApiOperation("单个/批量删除")
    public R<String> deleteByIds(@RequestParam("ids") String ids){
        return R.convert(algoTemplateFileFeignService.deleteByIds(ids));
    }

    /**
     * 算法浏览
     *
     * @return
     */
    @GetMapping(value = "/getById")
    @ApiOperation("算法浏览")
    public R<AlgoTemplate> getById(@RequestParam("id")Long id){
        return R.convert(algoTemplateFileFeignService.getById(id));
    }
}